package br.com.fatecjp.pooai.gerenciador.taxi.utils;

import java.util.Vector;

public class StringUtils {

	public static String[] split(String source, String separator) {

		Vector result = new Vector();

		int index = -1;
		do {

			index = source.indexOf(separator);
			if (index >= 0) {
				result.addElement(source.substring(0, index));
				source = source.substring(index + separator.length(),
						source.length());
			} else {
				if (source.length() > 0) {
					result.addElement(source);
				}
			}

		} while (index >= 0);

		String[] resultArray;
		if (result.size() > 0) {
			resultArray = new String[result.size()];
			result.copyInto(resultArray);
		} else {
			resultArray = new String[0];
		}

		return resultArray;

	}

}
